/// 旗帜标签
/// @author hzq
/// @param {Color} $fill - 旗帜标签背景颜色
/// @param {Color} $notch-color - 父级背景颜色
/// @param {Length} $length - 如水平，高度；如垂直，宽度
/// @param {String} $notch-side -  "top" | "right" | "bottom" | "left"
/// @param {Boolean} $isHorizontal - 是否水平;默认 false 垂直
@mixin flag(
  $fill,
  $notch-color,
  $length,
  $notch-side: "right",
  $isHorizontal: false
) {
  position: absolute;
  background: linear-gradient(lighten($fill, 20%), darken($fill, 10%));
  display: inline-block;
  padding-#{$notch-side}: $length;
  &::before {
    content: "";
    position: absolute;
    display: block;
    height: 0;
    width: 0;
    border-style: solid;
    border-width: calc($length / 2);
    border-color: transparent;
    border-#{$notch-side}-color: $notch-color;
    #{$notch-side}: -1px;
  }
  @if $isHorizontal {
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
    vertical-align: middle;
    height: $length;
    line-height: $length;
    @if $notch-side == "left" {
      right: -2px;
      padding-right: 10px;
      text-align: right;
    } @else {
      left: -2px;
      padding-left: 10px;
    }
    &::before {
      top: 0;
    }
  } @else {
    box-shadow: 1px 0 1px rgba(0, 0, 0, 0.35);
    text-align: center;
    width: $length;
    @if $notch-side == "bottom" {
      top: -2px;
      padding-top: 10px;
    } @else {
      bottom: -2px;
      padding-bottom: 10px;
    }
    &::before {
      left: 0;
    }
  }
}
